package com.zwj.apollo.service;

import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.ConfigService;

/**
 * @author 摸鱼二长老
 * @Date 2023/2/27 11:29 AM
 * @version 1.0
 */
public class GetConfigTest {
    private static final String SOME_KEY = "sms.enable";
    private static final String SQL_URL = "spring.datasource.url";
    private static final String NAME_SPACE = "account-namespace";

    public static void main(String[] args) {
        try {
            Config config = ConfigService.getConfig(NAME_SPACE);
            while (true) {
                Thread.sleep(1000);
                String property = config.getProperty(SQL_URL, null);
                System.out.println(property);
            }
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}
